#include "func.h"
#include "msgHandler.h"

int recv_msg(const int netfd, train_t *pTrain) {
    bzero(pTrain, sizeof(train_t));
    recv(netfd, &pTrain->length, sizeof(int), MSG_WAITALL);
    recv(netfd, pTrain->data, pTrain->length, MSG_WAITALL);
}

int send_msg(const int netfd, train_t *pTrain) {
    send(netfd, pTrain, sizeof(int)+pTrain->length, MSG_NOSIGNAL);
}
